<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <script src="vue.js"></script>
</head>

<body>
    <div id="root">
        <p>￥：<input type="number" v-model="rnb"></p>
        <p> &nbsp;$ ：<input type="text" v-model="usd"></p>

        <p v-if="rnb!=0">{{rnb}}人民币={{usd}}美元</p>
    </div>

    <script>
        Vue.config.productionTip = false;

        const vm = new Vue({
            el: '#root',
            data: {
                rnb: '',
                usd: '',
            },
            watch: {
                rnb() {
                    this.usd = parseFloat(0.1405 * this.rnb).toFixed(4)
                }
            },

        })

    </script>
</body>

</html>